<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/pages/comm/comm.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>党建微课用户查询统计平台</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
 <link href="${ctx }/static/css/bootstrap.css" rel="stylesheet" type="text/css"/>
    <link href="${ctx }/static/css/login.css" rel="stylesheet" type="text/css"/>
    <link href="${ctx }/static/js/layer/skin/layer.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    @font-face {font-family: 'Glyphicons Halflings';
    src: url('${ctx }/static/fonts/glyphicons-halflings-regular.eot');
	src: url('${ctx }/static/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('/static/fonts/glyphicons-halflings-regular.woff') format('woff'), url('/static/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('/static/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
    </style>
    

  </head>
  <script src="${ctx }/static/js/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="${ctx }/static/js/layer/layer.js"></script>
  <body>
  <div class="login-container">
  <div class="login-box">
		<div class="login-title text-center">
			<h1><small>党建微课用户查询统计平台</small></h1>
		</div>
		<div class="login-content">
			<div class="form">
  <form action="#" method="post">
					<div class="form-group">
						<div class="col-xs-12">
							<div class="input-group">
								<span class="input-group-addon"><span class="glyphicon user"></span></span>
								<input type="text" id="username" name="username" class="form-control" placeholder="用户名">
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-xs-12">
							<div class="input-group">
								<span class="input-group-addon"><span class="glyphicon lock"></span></span>
								<input type="password" id="password" name="password" class="form-control" placeholder="密码">
							</div>
						</div>
					</div>
					<div class="form-group form-actions">
						<div class="col-xs-4 col-xs-offset-4 ">
							<button type="button" class="btn btn-sm btn-info"  onclick="login()">
							<span class="glyphicon off"></span>  登录</button>
						</div>
					</div>
				</form>
				</div>
		</div>
	</div>
	</div>
</div>
				
  </body>
  <script type="text/javascript">
$(function(){
	document.onkeydown = function(e){
		e = e||event;
		var code = -1;
		code = e.keyCode || e.which || e.charCode
		if(code==13){
			login();
		}
	}
});

function   login(){

   var userName=$("#username").val();
   var password=$("#password").val();

   if(userName ==""){
      layer.msg("请输入用户名");
      return;
   }
   if(password ==""){
      layer.msg("请输入密码");
      return;
   }
   $.ajax({
    		url: '${ctx}'+'/user/login',
    		type: 'post',
    		dataType: 'json',
    		data: {
              "userName":userName,
              "password":password
    		},
    		success: function (data) {
    		    if(data.code == 200){
    		      layer.msg("登录成功");
    		      window.location.href='${ctx}'+'/defaultPage';
    		    }else{
    		      layer.msg(data.msg);
    		    }
    		}
    });
}
</script>
</html>
